import request from '@/utils/request'
import BaseUrl from '@/utils/BaseUrl'
import { getRealname } from '@/utils/auth'

/**
 * 列表
 * @param query
 * @returns {AxiosPromise}
 */
export function listGenField(query) {
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/field/list',
    async: false,
    data: query
  })
}

/**
 * 删除
 * @param data
 * @returns {AxiosPromise}
 */
export function deleteGenField(data) {
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/field/delete',
    data: data
  })
}

/**
 * 增加
 * @param data
 * @returns {AxiosPromise}
 */
export function addGenField(data) {
  data.createdBy = getRealname()
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/field/add',
    data: data
  })
}

/**
 * 修改
 * @param data
 * @returns {AxiosPromise}
 */
export function updateGenField(data) {
  data.modifiedBy = getRealname()
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/field/update',
    data: data
  })
}

/**
 * 获取单个
 * @param query
 * @returns {AxiosPromise}
 */
export function getGenField(query) {
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/field/get',
    data: query
  })
}
